-
-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-uninstall auto-installed modules #2753
Auto-uninstall auto-installed modules #2753
Conversation
7df5118
to
398d01b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remove a mod (6CSL) with auto-installed dependencies (MM), the reason for action for the auto-removed mod is wrong:
If you clear the changeset on the changeset tab (doesn't matter if there's an "auto-remove" in the changeset or not), ckan crashes:
System.NullReferenceException: Object reference not set to an instance of an object
at System.Windows.Forms.DataGridViewCellCollection.get_Item (System.String columnName) [0x0002e] in <8aef12e05d8341c2ba53ae50a7bb2ab8>:0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.DataGridViewCellCollection.get_Item(string)
at CKAN.GUIMod.SetUpgradeChecked (System.Windows.Forms.DataGridViewRow row, System.Nullable`1[T] set_value_to) [0x00007] in <c787e8ddab794c269a4e41cd1bd477ae>:0
at CKAN.Main.ClearChangeSet () [0x00061] in <c787e8ddab794c269a4e41cd1bd477ae>:0
at CKAN.Main.CancelChangesButton_Click (System.Object sender, System.EventArgs e) [0x00001] in <c787e8ddab794c269a4e41cd1bd477ae>:0
at System.Windows.Forms.Control.OnClick (System.EventArgs e) [0x00019] in <8aef12e05d8341c2ba53ae50a7bb2ab8>:0
at System.Windows.Forms.Button.OnClick (System.EventArgs e) [0x0001e] in <8aef12e05d8341c2ba53ae50a7bb2ab8>:0
at System.Windows.Forms.ButtonBase.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00069] in <8aef12e05d8341c2ba53ae50a7bb2ab8>:0
at System.Windows.Forms.Button.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00000] in <8aef12e05d8341c2ba53ae50a7bb2ab8>:0
at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m) [0x00078] in <8aef12e05d8341c2ba53ae50a7bb2ab8>:0
at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x001b4] in <8aef12e05d8341c2ba53ae50a7bb2ab8>:0
at System.Windows.Forms.ButtonBase.WndProc (System.Windows.Forms.Message& m) [0x00037] in <8aef12e05d8341c2ba53ae50a7bb2ab8>:0
at System.Windows.Forms.Button.WndProc (System.Windows.Forms.Message& m) [0x00000] in <8aef12e05d8341c2ba53ae50a7bb2ab8>:0
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <8aef12e05d8341c2ba53ae50a7bb2ab8>:0
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <8aef12e05d8341c2ba53ae50a7bb2ab8>:0
at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x00085] in <8aef12e05d8341c2ba53ae50a7bb2ab8>:0
Can you be more specific about the steps to crash? If I cancel out of uninstalling 6 Crew Science Lab, it just goes back to the mod list for me, no crash. |
Let me try to find the exact line with some debugging. |
The reason for the auto removal action should be fixed now. |
As for the crash, maybe Mono doesn't support indexing a row's |
Selecting |
That calls into the exact same function that's crashing, so if it's behaving differently, then I have no idea. Lines 569 to 574 in df8fb70
Lines 318 to 328 in df8fb70
|
One more thing: If you downgrade a mod, the auto-installed tag is lost. |
I didn't consciously consider downgrading, but it doesn't sound broken to me. When in doubt, there's a column where the user can change it. |
Setting the |
Well, here's the mono code that's throwing that exception: if (columnName == null)
throw new ArgumentNullException ("columnName");
foreach (DataGridViewCell cell in base.List) {
if (string.Compare (cell.OwningColumn.Name, columnName, true) == 0)
return cell;
}
throw new ArgumentException (string.Format (
"Column name {0} cannot be found.",
columnName), "columnName"); Looks like an NRE would mean that either |
Yep works! |
Yeah, that's needed of course. I'm not sure how it should look, though. I guess another status symbol representing auto installed? And then a command / keystroke to toggle. |
The toggle option / keystroke could be "hidden" inside the details view, to avoid cluttering the "main" modlist view. |
I'm thinking it might be nice to adopt the same symbol in both CmdLine and ConsoleUI, and CmdLine already uses "A" for manually installed mods. So "a" might be a bit confusing. |
The other wrinkle is that unlike the existing status symbols in both UIs, this one would need to work alongside the existing ones, since an auto installed mod can also be upgradeable, broken, etc. So e.g. if we used "@", then CmdLine would show an upgradeable auto installed mod as "^@", a normal auto installed mod as "-@", etc. EDIT: Or, maybe treating it as an alternate form of "-" is sufficient. If a mod is upgradeable, do I really care that it's also auto installed? |
@DasSkelett, I'm going to add the CmdLine and ConsoleUI changes here. Would you mind un-approving so we can track the review of those changes? |
Lemme figure out how to do that.... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't remove my previous approval, but I can approve the new commits!
Work fine.
f4c1c4a
to
f2f40cb
Compare
Oooh, excellent! I've been meaning to raise an issue for this. |
Motivation
Installing a module pulls in its dependencies automatically. If the user later uninstalls that module, they may wish to remove the dependencies as well, but there's no easy way to identify them.
Debian's APT package management system has a concept of "automatically installed packages," which handles this situation nicely:
https://www.debian.org/doc/manuals/aptitude/ch02s02s06.en.html
Changes
Now CKAN supports a concept of automatically installed modules.
Fixes KSP-CKAN/NetKAN#6825 (because the motivation behind that issue was cleaning up dependencies that are no longer needed).
GUI
When you install a mod:
... a new checkbox column appears called "Auto-installed":
This will be checked for mods that were installed due to dependencies, and unchecked for mods the user chose to install. Recommendations and suggestions are considered as user-chosen. Any modules installed before the user upgraded to this version of CKAN will be treated as user-chosen.
When you remove a mod, we check for any auto-installed modules that will no longer be needed, and automatically add them to the change set:
The user can toggle the checkboxes to control whether a module should be considered auto-installed:
If a module was previously considered auto-installed, unchecking the box will "anchor" it so that it can no longer be auto-removed. If the module was previously not considered auto-installed, checking the box will allow the module to be auto-removed; if it currently has no depending mods, it will be added to the changeset for removal immediately:
You can hide the new column, since it may not be useful to some users:
To make this work, a new property
InstalledModule.auto_installed
is added that will be saved toregistry.json
. I don't think this requires an update of the schema or the spec, becauseInstalledModule
is a private object that CKAN creates and consumes internally.To make the checkbox column work, we now only reference columns by name instead of by index.
CmdLine
CmdLine is updated to print "+" as the symbol for auto installed:
You can mark modules as auto-installed via CmdLine:
Or unmark them:
ConsoleUI
ConsoleUI is updated along the same lines: